package com.gxz.common;


import lombok.Data;

@Data
public class Result {
    public static final Integer SUCCESS_CODE = 200;
    public static final Integer ERROR_CODE = 500;
    public static final Integer BUSINESS_ERR_CODE = 50010;
    public static final Integer SYSTEM_ERR_CODE = 60010;
    public static final Integer UNKNOW_ERR_CODE = 70010;

    public static final String ERROR_MESSAGE = "服务器异常";
    public static final String SUCCESS_MESSAGE = "操作成功";


    public static Result success(Object data) {
        return new Result(SUCCESS_CODE, data, SUCCESS_MESSAGE);
    }

    public static Result error(String message) {
        return new Result(ERROR_CODE, null, message);
    }


    private Integer code;
    private Object data;
    private String message;

    public Result(Integer code, String message) {
        this.code = code;
        this.message = message;
    }
    public Result(Integer code, Object data, String message) {
        this.code = code;
        this.data = data;
        this.message = message;
    }
}
